package com.weishuang.monitor.leader.controller;


import com.weishuang.monitor.leader.commons.entity.Result;
import com.weishuang.monitor.leader.commons.utils.ResultUtils;
import com.weishuang.monitor.leader.entity.ServerCpuRealTime;
import com.weishuang.monitor.leader.service.IServerCpuRealTimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 服务器CPU实时信息 前端控制器
 * </p>
 *
 * @author weishuang
 * @since 2021-03-23
 */
@RestController
@RequestMapping("/leader/serverCpuRealTime")
public class ServerCpuRealTimeController {

    @Autowired
    private IServerCpuRealTimeService serverCpuRealTimeService;

    /**
     * 查询最新N条cpu实时信息
     * @param sysId
     * @return
     */
    @GetMapping("listTop/{sysId}")
    public Result listTop(@PathVariable String sysId) {
        List<ServerCpuRealTime> list = serverCpuRealTimeService.listTop(sysId);
        return ResultUtils.success(list);
    }
}
